//
//  MLZShowImageTableViewCell.m
//  MotherLover
//
//  Created by lanou on 16/1/7.
//  Copyright © 2016年 zj. All rights reserved.
//

#import "MLZShowImageTableViewCell.h"
#define CTandB 10
#define CLandR 10
#define CM 5
@implementation MLZShowImageTableViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{

    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
    //标题
    self.labeleTitle = [[UILabel alloc]initWithFrame:CGRectMake(CLandR, CTandB, KW-CLandR*2, 40)];
        _labeleTitle.numberOfLines= -1;
        
    [self.contentView addSubview:_labeleTitle];
//图片
        
        for (int i = 0 ; i < 3; i++) {
            UIImageView *image = [[UIImageView alloc]initWithFrame:CGRectMake(CLandR+((KW-CLandR*2-CM*2)/3+CM)*i, self.labeleTitle.bottom+CTandB, (KW-CLandR*2-CM*2)/3, (KW-CLandR*2-CM*2)/3)];
            image.tag = i+100;
            [self.contentView addSubview:image];
        }
        
        _imageLeft  = [self.contentView viewWithTag:100];
        _imageMind  = [self.contentView viewWithTag:101];
        _imageRight = [self.contentView viewWithTag:102];
        
//类型
        _lableType = [[UILabel alloc]initWithFrame:CGRectMake(self.imageRight.right-150,self.imageRight.bottom+CTandB , 150, 30)];
        
        _lableType.font= [UIFont systemFontOfSize:12];
        _lableType.textColor = [UIColor grayColor];
//        [self.contentView addSubview:_lableType];
        
    }

    return self;
    
}
-(void)setModel:(MLZShowModel *)model{

    _labeleTitle.text = model.title;
    [_labeleTitle sizeToFit];
    NSArray *arr = @[model.nickname,model.cate];
    NSString *srt = [arr componentsJoinedByString:@"|"];
    _lableType.text= srt;
    [_imageLeft sd_setImageWithURL:[NSURL URLWithString:model.pics[0]]];
    [_imageMind sd_setImageWithURL:[NSURL URLWithString:model.pics[1]]];
    [_imageRight sd_setImageWithURL:[NSURL URLWithString:model.pics[2]]];






}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
